<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>测试网页</title>

</head>
<script src="../js/jquery-3.3.1.min.js"></script>
<script>
    function outputObj(obj) {
        var description = "";
        for (var i in obj) {
            description += i + " = " + obj[i] + "\n";
        }
       return description;
    }
    $(function () {
        $("#submit").click(function () {
            var requestService = $("#requestService").val();
            var requestMethod = $("#requestMethod").val();
            var requestParam = $("#requestParam").val().toString();
            var resultArea=$("#resultArea");
            $.ajax({
                type: "POST",
                url: "http://localhost:8080/learnqipayapi/app/" + requestService + "/" + requestMethod,
                data: requestParam,
                dataType: "json",
                success : function(msg){
                    resultArea.val(outputObj(msg));
                    alert(msg.toString());
                },
                error:function () {
                    resultArea.val("系统内部错误");
                }

            });

        });
    });


</script>
<body>
<div id="center-box" style="width: 500px;height: auto">
    <input id="requestService" name="requestService" type="text"><br>
    <input id="requestMethod" name="requestMethod" type="text"><br>
    <input id="requestParam" name="requestParam" type="text"><br>
    <button id="submit">确定提交</button>
    <br>
</div>
<div id="result">
    <textarea id="resultArea">

    </textarea>
</div>


</body>
</html>